﻿using System;
using System.Collections.Generic;
using System.Linq;
using Ionic.Zip;

namespace UTL
{
    /// <summary>
    /// Perform zip file
    /// </summary>
    public class Zip
    {
        /// <summary>
        /// Extract zip file
        /// </summary>
        /// <param name="file">File zip need to extract</param>
        /// <param name="path">Path the place to extracted</param>
        /// <returns>True if successful else false</returns>
        public static bool Extract(string file, string path)
        {
            try
            {
                ZipFile zip = ZipFile.Read(file);
                zip.ExtractAll(path, ExtractExistingFileAction.DoNotOverwrite);
                return true;
            }
            catch { return false; }
        }
    }
}